<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		构造函数设计模式：函数执行，添加new
		<script>
			function Fn(x, y) {
			    let sum = 10;
			    this.total = x + y; //私有属性            
			    this.say = function () {//私有方法
			        console.log(`我计算的和是:${this.total}`);
			    };
			    //return {name:"lili",age:88};
			}
			//let res = Fn(10, 20); //普通函数执行
			let f1 = new Fn(10, 20); //构造函数执行
			console.log(f1);
			// console.log(f1.total);
			// f1.say();
		</script>
	</body>
</html>
